package Utility;

import org.apache.taglibs.standard.lang.jpath.encoding.HtmlEncoder;

public class HtmlEncode {
    
   public static  String Encode(String sd)
   {
   StringBuffer sb= new StringBuffer(sd);
  
  int i=-1;
       while ((i=sb.indexOf("<pre class=\"brush: java\">",i+1))!=-1) {           
         System.out.println("i="+i);
          int j= sb.indexOf("</pre>",i);
           for (int k = i+25; k < j; k++) {
             
               System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"+sb.charAt(k));
               switch(sb.charAt(k))
               {
               
                   case '<':
                           sb.replace(k, k+1, "&lt;");  k+=3; j+=3;
                           break;
                       
                   case '>':
                            sb.replace(k, k+1, "&gt;");  k+=3; j+=3;                          
                           
                       break;
               
               }
            
            
           }
           
             
           
       }
       System.out.println(sb);
   return  sb.toString();
   }
   
 
    
}
